import tesserocr
from PIL import Image
image_to_parse=Image.open("img.png")
text_result=tesserocr.image_to_text(image_to_parse)
print(text_result)
image_to_convert=image_to_parse.convert('L')
image_to_convert.show()
image_to_convert=image_to_parse.convert('cookies.json')
image_to_convert.show()
threshold=50
chart=[]
for i in range(256):
    if i<threshold:
        chart.append(0)
    else:
        chart.append(1)
image_for_threshold=image_to_convert.point(chart,'cookies.json')
image_for_threshold.show()
text_result=tesserocr.image_to_text(image_for_threshold)
print(text_result)